<extend name="Public/base" />
<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="{:U('Index/index')}" data-original-title="首页"><i class="icon-home"></i> 首页</a>
			<a class="tip-bottom" href="{:U('Action/index')}" data-original-title="">行为管理</a> <a class="current" href="{$post_url}">{$meta_title}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br/>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
						<h5>{$meta_title}</h5>
					</div>
					<div class="widget-content nopadding">
						<form class="form-horizontal" method="get" action="">
							<div class="control-group">
								<label class="control-label">行为标识 :</label>
								<div class="controls">
									<input type="text" placeholder="行为标识" class="ui-wizard-content" name="name" value="{$list.name}" >
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">行为名称 :</label>
								<div class="controls">
									<input type="text" placeholder="行为名称" class="ui-wizard-content" name="title" value="{$list.title}">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">行为类型:</label>
								<div class="controls">
									<select class="form-control span2" name="type">
										<volist name=":get_action_type(null,true)" id="vo">
											<option value="{$key}">{$vo}</option>
										</volist>
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">行为描述 :</label>
								<div class="controls">
									<textarea name="remark"  placeholder="行为描述" class="span7">{$list.remark}</textarea>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">行为规则 :</label>
								<div class="controls">
									<textarea name="rule"  placeholder="行为规则" class="span7">{$list.rule}</textarea>
									<br><span class="help-block blue mt10">（行为规则 :table:$table|field:$field|condition:$condition|rule:$rule[|cycle:$cycle|max:$max][;......]）</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">日志规则 :</label>
								<div class="controls">
									<textarea name="log"  placeholder="日志规则" class="span7">{$list.log}</textarea>
									<br><span class="help-block blue mt10">（记录日志备注时按此规则来生成，支持[变量|函数]。目前变量有：user,time,model,record,data）</span>
								</div>
							</div>
							<div class="form-actions">
								<button class="btn btn-success" type="submit">提交</button>
							</div>
							<input type="hidden" name="id" value="{$list.id}"/>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	
	//select 默认值
	/* set_value("type", {$list.type|default=0}); */
	//初始化登录用户名输入焦点
	tke_form_focus();
	$("form").submit(function(){
		//锁定登录按钮
		$('button').attr('disabled',true);
		var self = $(this);
		$.post("{$post_url}", self.serialize(), call_back, "json");
		return false;
		
		/**
		 * @todo 接收登录返回值
		 * @author PHP@妖孽 <dino_ma@163.com>
		 */
		function call_back(data){
			if(data.status==1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
				  if (data.url) {
						location.href=data.url;
					}else{
						location.reload();
					}
				},1500);
			} else {
				$('button').attr('disabled',false);
				tke_alert(data.info,'alert-error');
			}
		}
	});
	//导航高亮
	highlight_subnav("{:U('Action/index')}");
});
</script>
</block>